<template>
  <div @click="test">child {{  attrs }}</div>
</template>
<script setup lang="ts">
import { progressProps } from 'element-plus';
import { ref, useAttrs, getCurrentInstance, inject } from 'vue'

const attrs = useAttrs()

const emit = defineEmits<{
  (e: 'change', id: number): void
  (e: 'update', value: string): void
}>()

export interface CrudApi {
  save?: () => void
  update?: (val: any) => void
  refresh?: (val: any) => void  
  remove?: (val: any[], finish: () => void) => void
}

interface Props {
  crud?: CrudApi
  maxHeight?: number | string
}
const props = withDefaults(defineProps<Props>(), {})

const fun = inject('fun') as Function

function test() {
  let refresh = props.crud?.refresh
  refresh && refresh(1)
  emit('change', 1)
}
</script>

<style lang="scss" scoped></style>
